using UnityEngine;
using UnityEngine.UI;

public class UIToolBarItem : MonoBehaviour
{
	public Image imgIcon;

	public Text txtNumber;

	public int itemId;

	private Button _btnItem;

	public bool enableBtn
	{
		get
		{
			return _btnItem.interactable;
		}
		set
		{
			_btnItem.interactable = value;
		}
	}

	private void Awake()
	{
		_btnItem = imgIcon.GetComponent<Button>();
	}

	private void Update()
	{
	}

	public void UseItem()
	{
		if (EternalNode.Instance.bShowPropTip)
		{
			UIADViewWnd.ConfirmUseProp(imgIcon.sprite, delegate
			{
				int num2 = ItemMgr.instance.UseItem(itemId);
				txtNumber.text = num2 + string.Empty;
				enableBtn = false;
			});
			EternalNode.Instance.bShowPropTip = false;
			if (!AdManager1.instance.ShieldAddress)
			{
				AdManager.single.ShowNative();
			}
		}
		else
		{
			int num = ItemMgr.instance.UseItem(itemId);
			txtNumber.text = num + string.Empty;
			enableBtn = false;
		}
	}
}
